package com.yyd.designmodel.strategy.impl;

import com.yyd.designmodel.strategy.Apple;
import com.yyd.designmodel.strategy.Discountable;
import com.yyd.designmodel.strategy.Discountor;

/**
 * 
* @ClassName: AppleWeightDiscountor 苹果重量打折策略
* @Description: 根据购买的苹果重量来进行打折
* @author yuyidi
* @date 2015年5月26日 下午2:46:35*
 */
public class AppleWeightDiscountor implements Discountor {

	@Override
	public void discount(Discountable discountable) {
		Apple apple = (Apple) discountable;
		double weight = apple.getWeight();
		if(weight<10){
			System.out.println("购买的苹果重量未达到10斤，不能进行打折，总共价格为："+weight*apple.getPrice());
		}else if(weight>=10 && weight<50){
			System.out.println("购买的苹果超过10斤，但未达到50斤，打88折，总价格为："+weight*apple.getPrice()*0.88);
		}else if(weight>50){
			System.out.println("购买苹果总重量超过50斤，打5折，总价格为："+weight*apple.getPrice()*0.5);
		}
	}

}
